#include "gd32f30x.h"
#include "lvd.h"

#if ENABLE_LVD_TEST == 1

void lvd_config(void)
{
     /* NVIC configuration */
    nvic_irq_enable(LVD_IRQn,0,0);
    /* enable clock */
    rcu_periph_clock_enable(RCU_PMU);
    /* EXTI_16 configuration */
    exti_init(EXTI_16, EXTI_INTERRUPT, EXTI_TRIG_BOTH);
    /* configure the LVD threshold to 2.9v */
    pmu_lvd_select(PMU_LVDT_5);
}

#endif //#if ENABLE_LVD_TEST == 1